﻿using Grpc.Core;
using Grpc.Health.V1;
using Grpc.HealthCheck;
using System.Threading.Tasks;
using static Grpc.Health.V1.HealthCheckResponse.Types;

namespace MediatRTest.Services
{
    public class HealthCheckService : HealthServiceImpl
    {
        public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context)
        {
            return Task.FromResult(new HealthCheckResponse { Status = ServingStatus.Serving });
        }

        public override async Task Watch(HealthCheckRequest request, IServerStreamWriter<HealthCheckResponse> responseStream, ServerCallContext context)
        {
            await responseStream.WriteAsync(new HealthCheckResponse { Status = ServingStatus.Serving });
        }
    }
}
